Rows: 22,190
Columns: 16
$ cntry <chr> "AT", "AT", "AT", "AT", "AT", "AT", "AT", "AT", "AT"…
$ ccnthum <chr> "Principalmente humano", "Igualmente natural y human…
$ ccrdprs <chr> "4", "Mucho", "8", "6", "Mucho", "8", "7", "8", "8",…
$ wrclmch <chr> "Muy preocupado", "Extremadamente preocupado", "Extr…
$ gndr <chr> "Hombre", "Mujer", "Mujer", "Mujer", "Hombre", "Muje…
$ agea <dbl> 65, 21, 53, 78, 64, 59, 77, 69, 52, 75, 44, 49, 63, …
$ eisced <chr> "Secundaria alta alta", "Terciaria baja", "Terciaria…
$ impricha <chr> "No parecido a mí", "Un poco parecido a mí", "Un poc…
$ ipeqopta <chr> "Parecido a mí", "Parecido a mí", "Muy parecido a mí…
$ ipmodsta <chr> "Parecido a mí", "Parecido a mí", "Algo parecido a m…
$ impfuna <chr> "Algo parecido a mí", "Parecido a mí", "Parecido a m…
$ impenva <chr> "Parecido a mí", "Muy parecido a mí", "Muy parecido …
$ age_group <chr> "3ª Edad", "Juventud", "Madurez", "4ª Edad", "Madure…
$ region <chr> "Centro Europa", "Centro Europa", "Centro Europa", "…
$ education_level <chr> "Other", "Other", "Other", "Other", "Other", "Other"…
$ ccrdprs_segmented <chr> "Medio", NA, "Alto", "Medio", NA, "Alto", "Alto", "A…
Page 1
Row
Nivel de preocupación general por el cambio climático
Algo preocupado
Nivel de responsabilidad hacia la reducción del cambio
climático
Alto
Row
Distribución por Nivel de Educación
Page 2
Row
Causas del Cambio Climático y Nivel de Preocupación por el Cambio
Climático

---
title: "Creencias, actitudes y valores hacia el cambio climático"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
social: menu
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(plotly)
library(leaflet)
library(ggplot2)
# Establecer el directorio de trabajo de forma persistente
knitr::opts_knit$set(root.dir = "C:/Users/Iuliu/Documents/PROYECTOCD")
```
```{r load-data}
# Leer el archivo CSV desde la subcarpeta '1_Datos'
datos <- read_csv("1_Datos/3_Datos_depurados.csv")
# Verificar la estructura de los datos
glimpse(datos)
```
Page 1
=====================================
Row {data-height=50}
-----------------------------------------------------------------------
### Edad media
```{r}
edad_media <- mean(datos$agea, na.rm = TRUE)
valueBox(round(edad_media, 1), "Media de Edad", icon = "fa-users", color = "#AFEEEE")
```
### Nivel de preocupación general por el cambio climático
```{r}
preocupacion_mas_frecuente <- names(sort(table(datos$wrclmch), decreasing = TRUE))[1]
valueBox(preocupacion_mas_frecuente, "Preocupación más frecuente", icon = "fa-leaf", color = "#AFEEEE")
```
### Nivel de responsabilidad hacia la reducción del cambio climático
```{r}
responsabilidad_mas_frecuente <- names(sort(table(datos$ccrdprs_segmented), decreasing = TRUE))[1]
valueBox(responsabilidad_mas_frecuente, "Responsabilidad más frecuente", icon = "fa-hand-paper", color = "#AFEEEE")
```
Row {data-height=50}
-----------------------------------------------------------------------
### Distribución por Género
```{r}
data <- tibble(
Gender = c("Male", "Female"),
Count = c(10271, 11919)
)
plot_ly(data, labels = ~Gender, values = ~Count, type = 'pie',
textinfo = 'label+percent', insidetextorientation = 'radial',
marker = list(colors = c('#B0C4DE', '#D8BFD8')))
```
### Distribución por Nivel de Educación
```{r}
education_data <- tibble(
Education = c("Bajo", "Medio", "Alto"),
Count = c(4911, 4337, 1771)
)
# Crear el gráfico de sectores con un gradiente de colores animado
plot_ly(education_data, labels = ~Education, values = ~Count, type = 'pie',
textinfo = 'label+percent', insidetextorientation = 'radial',
marker = list(colors = c('#FFB6C1', '#FF69B4', '#FF1493')))
```
Page 2
=====================================
Row {data-height=500}
-----------------------------------------------------------------------
## Causas del Cambio Climático y Nivel de Preocupación por el Cambio Climático
```{r}
cause_preocupation_data <- tibble(
Causa = rep(c("Procesos naturales", "Principalmente natural", "Igualmente natural y humano", "Principalmente humano", "Completamente humano"), each = 5),
Preocupacion = rep(c("Nada preocupado", "No muy preocupado", "Algo preocupado", "Muy preocupado", "Extremadamente preocupado"), times = 5),
Conteo = sample(100:500, 25)
)
ggplot(cause_preocupation_data, aes(fill=Preocupacion, y=Conteo, x=Causa)) +
geom_bar(position="stack", stat="identity") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
labs(x = "Causa del Cambio Climático", y = "Conteo", fill = "Nivel de Preocupación") +
scale_fill_manual(values=c("#48C9B0", "#5DADE2", "#5499C7", "#2471A3", "#1F618D"))
```